/*  Sgvizler example convenience functions
 *  (c) 2011 Martin G. Skjæveland
 *
 *  Sgvizler is freely distributable under the terms of an MIT-style license.
 *  Sgvizler web site: https://code.google.com/p/sgvizler/
 *--------------------------------------------------------------------------*/

sgvizler.example.copyElementAsText = function(getid, setid) {
    var get = document.getElementById(getid),
        s = "&lt;" + "div ";
    for(var i = get.attributes.length-1; i>-1; i--){
	s += get.attributes[i].nodeName + '="' + get.attributes[i].nodeValue + '"\n\t';
    }
    $('#'+setid).html(s + "&gt;&lt;/div&gt;");
};

sgvizler.example.copyQuery = function(getid, setid) {
    var get = document.getElementById(getid),
        set = document.getElementById(setid),
        attr = ["data-sgvizler-query", "data-sgvizler-endpoint", "data-sgvizler-rdf"];
    for(var i = 0; i < attr.length; i++){
	if(get.getAttribute(attr[i])){
	    set.setAttribute(attr[i], get.getAttribute(attr[i]));}
    }
};